import request from '@/utils/request'

/**
 *
 * @returns 组织架构信息获取
 */
export const getDepartmentListApi = () => {
  return request({
    url: '/company/department'
  })
}
/**
 *
 * @param {*} id 用户id
 * @returns 删除请求
 */
export const delDepartmentApi = id => {
  return request({
    url: `/company/department/${id}`,
    method: 'delete'
  })
}
/**
 * 获取部门负责人数据
 * @returns
 */
export const getUserSimpleListApi = () => {
  return request({
    url: '/sys/user/simple'
  })
}

/**
* 添加部门列表
 * @param {*} form 添加部门列表所需参数
 * @returns
 */
export const addDepartmentApi = form => {
  return request({
    url: '/company/department',
    data: form,
    method: 'post'
  })
}

/**
* 编辑部门列表
 * @param {*} form 编辑部门列表所需参数
 * @returns
 */
export const getDepartDetailApi = id => {
  return request({
    url: `/company/department/${id}`
  })
}

/**
 * 编辑部门
 ***/
export function updateDepartmentsApi(data) {
  return request({
    url: `/company/department/${data.id}`,
    method: 'put',
    data
  })
}
